<template>
	<view class="boxHeight bgw">
		<image class="login-bg" src="/static/images/login-bg.jpg" mode="widthFix"></image>
		<view style="position: relative;">
			<u-gap height="50"></u-gap>
			<image class="logo-img" src="/static/images/logo.jpg" mode="widthFix"></image>
			<view class="text-center" style="font-size: 40upx;">
				恒隆康餐饮
			</view>
			<view class="blank30"></view>
			<view class="wrapper">
				<view class="">
					<u--form labelPosition="top" :model="form" ref="uForm" errorType="toast">
						<u-form-item prop="mobile" borderBottom>
							<view class="flex">
								<view class="mr15">
										<text class="iconfont icon-zhanghao" style="font-size: 20px;"></text>
								</view>
								<u--input v-model="form.login" border="none" fontSize="14" :customStyle="inputCustomStyle"
									placeholder="请输入登录账号" clearable></u--input>
							</view>
						</u-form-item>
						<view>
							<u-form-item prop="pwd" v-if="openEye" borderBottom>
								<view class="flex">
								<view class="mr15">
										<text class="iconfont icon-mima" style="font-size: 20px;"></text>
								</view>
								<!-- #ifndef APP-NVUE -->
								<u-input v-model="form.pwd" border="none" fontSize="14" :customStyle="inputCustomStyle"
									placeholder="请输入登录密码" type="text" clearable>
								<!-- #endif -->
									<!-- #ifdef APP-NVUE -->
									<u--input v-model="form.pwd" border="none" fontSize="14" :customStyle="inputCustomStyle"
										placeholder="请输入登录密码" type="text" clearable>
									<!-- #endif -->
										<view class="" slot="suffix" @click="openEye = !openEye">
											<u-icon name="eye" color="#999999" size="18"></u-icon>
										</view>
								<!-- #ifndef APP-NVUE -->
								</u-input>
								<!-- #endif -->
								<!-- #ifdef APP-NVUE -->
								</u--input>
								<!-- #endif -->
								</view>
							</u-form-item>
							<u-form-item prop="pwd" v-if="!openEye" borderBottom>
								<view class="flex">
								<view class="mr15">
										<text class="iconfont icon-mima" style="font-size: 20px;"></text>
								</view>
								<!-- #ifndef APP-NVUE -->
								<u-input v-model="form.pwd" border="none" fontSize="14" :customStyle="inputCustomStyle"
									placeholder="请输入登录密码" type="password" clearable>
								<!-- #endif -->
									<!-- #ifdef APP-NVUE -->
									<u--input v-model="form.pwd" border="none" fontSize="14" :customStyle="inputCustomStyle"
										placeholder="请输入登录密码" :type="password" clearable>
									<!-- #endif -->
										<view class="" slot="suffix" @click="openEye = !openEye">
											<u-icon name="eye-off" color="#999999" size="18"></u-icon>
										</view>
								<!-- #ifndef APP-NVUE -->
								</u-input>
								<!-- #endif -->
								<!-- #ifdef APP-NVUE -->
								</u--input>
								<!-- #endif -->
								</view>
							</u-form-item>
						</view>
						<!-- <u-form-item>
						<view class="flex justify-between" style="width: 100%;">
							<view class="flex flex-1">
								
							</view>
							<view class="font-22 u-content-color">
								忘记密码?
							</view>
						</view>
					</u-form-item> -->
					</u--form>
				</view>
				<u-gap height="30"></u-gap>
				<u-button type="primary" text="登录" @click="pwLogin"></u-button>
				<u-gap height="15"></u-gap>
			<!-- 	<u-button type="success" text="微信授权登录"></u-button>
				<u-gap height="15"></u-gap> -->
				<!-- <view class="">
					<u-checkbox-group>
						<u-checkbox activeColor="#00BF9B" v-model="isAgree" shape="circle" label=""></u-checkbox>
						<view class="text-gray">
							我已经阅读并同意
							<text class="text-link">服务协议</text>、
							<text class="text-link">隐私声明</text>
						</view>
					</u-checkbox-group>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	import {
		get_session_info,
		login,
		login_new,
		material_static_data,
		purchase_material_item,
		dish_material_common_data
	} from '@/common/api.js';
	export default {
		data() {
			return {
				form: {
					login: '', //张涛
					pwd: '', //zt1112
				},
				// rules: {
				// 	'login': {
				// 		type: 'string',
				// 		required: true,
				// 		message: '请填写登录账号',
				// 		trigger: ['blur', 'change']
				// 	},
				// },
				inputCustomStyle: {
					// backgroundColor: '#f7f7f7',
					// padding: '10px 15px',
					// 'border-bottom': '1px solid #E4E4E4',
					// 'border-radius': 0
				},
				openEye: false,
				isAgree: true,
				tips: '',

				wxLoginData: {},
				sessionKey: '',
				member_file: '',
				server_file: ''
			}
		},
		watch: {

		},
		methods: {
			// 密码登录
			pwLogin() {
				uni.$u.toast('该功能暂未开启');
				return;
				uni.$u.route({
					url: 'pages/index/index',
					type: 'switchTab'
				})
				return;
				if (!this.form.login) {
					uni.$u.toast('请输入登录账号');
					return false;
				}
				if (!this.form.pwd) {
					uni.$u.toast('请输入登录密码');
					return false;
				}
				return false;
				uni.showLoading({
					title: '提交中'
				})
				let data = {
					login: this.form.login,
					password: this.form.pwd,
				};
				uni.setStorageSync('loginInfo', data)
				login(data, {
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					}
				}).then(async (res) => {
					console.log(res);
					if (res == '登陆成功') {
						uni.$u.toast('登录成功');
						setTimeout(() => {
							uni.$u.route({
								url: 'pages/index/index',
								type: 'switchTab'
							})
						}, 2000);
						// this.get_purchase_material_item();
					} else {
						uni.$u.toast(res);
					}
				}).catch((res) => {
					console.log(res);
					if (typeof res == 'object') {
						uni.$u.toast(res.data);
					} else {
						uni.$u.toast(res || '错误-login');
					}


				}).finally(() => {
					// uni.hideLoading();
				})
			},
			getData() {

			}
		},
		onLoad() {
			// this.getData();
			try {
				let loginInfo = uni.getStorageSync('loginInfo') || {};
				this.form.login = loginInfo.login;
				this.form.pwd = loginInfo.password;
			} catch (e) {

			}
		},
	}
</script>

<style lang="scss" scoped>
	page,body {
		background-color: #ffffff;
	}
	.boxHeight{
		height: 100vh;
	}

	.wrapper {
		padding: 0 74upx;
	}

	.logo-img {
		display: block;
		margin: 0 auto 30upx;
		width: 140upx;
	}

	.text-link {
		text-decoration: underline;
		color: #1373AB;
	}
	.login-bg{
		position: fixed;
		bottom: 0;
		left:0;
		right:0;
		width: 750upx;
	}
</style>